package cn.wolfcode.trip.app.controller;

import cn.wolfcode.trip.base.domain.DynamicContent;
import cn.wolfcode.trip.base.domain.DynamicSecondaryReview;
import cn.wolfcode.trip.base.query.DynamicContentQueryObject;
import cn.wolfcode.trip.base.query.DynamicSecondaryReviewQueryObject;
import cn.wolfcode.trip.base.query.FriendPraiseQueryObject;
import cn.wolfcode.trip.base.service.IDynamicContentService;
import cn.wolfcode.trip.base.service.IDynamicSecondaryReviewService;
import cn.wolfcode.trip.base.util.JSONResult;
import com.github.pagehelper.PageInfo;
import jdk.nashorn.internal.objects.annotations.Getter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.Registration;
import java.util.List;

/**
 * 朋友圈动态控制器
 */
@RestController
@RequestMapping("/dynamicContent")
public class DynamicContentController {
    @Autowired
    private IDynamicContentService dynamicContentService;

    /**
     * 新增一条朋友圈动态
     * @param dynamicContent
     * @return
     */
    @PostMapping
    public JSONResult save(DynamicContent dynamicContent,String[] visits){
        dynamicContentService.save(dynamicContent,visits);
        return new JSONResult();
    }

    /**
     * 分页获取用户可以观看的所有朋友圈动态，会进行权限过滤
     */
    @GetMapping("/{userId}")
    public PageInfo get(DynamicContentQueryObject qo){
        return dynamicContentService.query(qo);
    }
}